// pages/invoice-demo/invoice-demo.js
Page({
  data: {
    currentDate: ''
  },

  onLoad: function() {
    // 设置页面标题
    wx.setNavigationBarTitle({
      title: '发票功能演示'
    });

    // 设置当前日期
    this.setCurrentDate();
  },

  // 设置当前日期
  setCurrentDate: function() {
    const today = new Date();
    const year = today.getFullYear();
    const month = String(today.getMonth() + 1).padStart(2, '0');
    const day = String(today.getDate()).padStart(2, '0');
    
    this.setData({
      currentDate: `${year}-${month}-${day}`
    });
  },

  // 测试发票预览功能
  testPreview: function() {
    wx.navigateTo({
      url: '/pages/invoice-preview/invoice-preview?invoiceId=INV001'
    });
  },



  // 测试查看发票功能
  testViewInvoice: function() {
    wx.navigateTo({
      url: '/pages/view-invoice/view-invoice?invoiceId=INV001&type=门诊收费&amount=500.00&date=2024-01-15&department=内科&doctor=李医生'
    });
  },

  // 页面分享
  onShareAppMessage: function() {
    return {
      title: '发票功能演示页面',
      path: '/pages/invoice-demo/invoice-demo',
      imageUrl: '/static/invoice-demo-share.png'
    };
  }
});
